/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managerBeanAdmin;

import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.Dependent;
import javax.faces.bean.SessionScoped;
import processor.ComplaintFacade;

import report.StatusReport;

/**
 *
 * @author maynoigi
 */
@Named(value = "statusReportBean")
@SessionScoped
public class StatusReportBean {

    @EJB
    private ComplaintFacade complaintFacade;
    private List<StatusReport> filteredReport;
    private List<StatusReport> statusReport;
    private Date daily;
    private Date fromWeekly;
    private Date toWeekly;
    String flag1 = "";

    public String getFlag1() {
        return flag1;
    }

    public void setFlag1(String flag1) {
        this.flag1 = flag1;
    }

  

    public Date getDaily() {
        return daily;
    }

    public void setDaily(Date daily) {
        this.daily = daily;
    }

    public Date getFromWeekly() {
        return fromWeekly;
    }

    public void setFromWeekly(Date fromWeekly) {
        this.fromWeekly = fromWeekly;
    }

    public Date getToWeekly() {
        return toWeekly;
    }

    public void setToWeekly(Date toWeekly) {
        this.toWeekly = toWeekly;
    }

    public List<StatusReport> getFilteredReport() {
        return filteredReport;
    }

    public void setFilteredReport(List<StatusReport> filteredReport) {
        this.filteredReport = filteredReport;
    }

    public List<StatusReport> getStatusReport() {
      
        if (flag1.equals("")) {
            statusReport = complaintFacade.StatusReport();
            flag1="All";
        } else if (flag1.equals("Daily")) {
            statusReport = complaintFacade.StatusReportDaily(daily);

        } else if (flag1.equals("In Range")) {
            statusReport = complaintFacade.StatusReportRange(fromWeekly, toWeekly);
        }

        return statusReport;
    }

    public void statusReportByDaily() {
        flag1 = "Daily";
    }

    public void statusReportByWeekly() {
        flag1 = "In Range";
    }

    public void setStatusReport(List<StatusReport> statusReport) {
        this.statusReport = statusReport;
    }

    public StatusReportBean() {
    }
}
